package com.sss.hloster0603;

public class SyncThread implements Runnable {
	private int tid;
//在线程类内部定义一个静态共享资源 lock
	private static Object lock = new Object();

	public SyncThread(int id) {

		this.tid = id;
	}
	
	public void run() {
		synchronized (lock) {
			for (int i = 0; i < 10; i++) {
				System.out.println("线程ID 名为：" + this.tid + " 正在输出：： " + i);
			}
		}
	}
}
